﻿<local:BaseWindow x:Class="PDFRider.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:PDFRider"
    xmlns:ltl="clr-namespace:LocTranslate;assembly=LocTranslateLibrary"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras"
    xmlns:ftc="clr-namespace:FTControls;assembly=FTControls"
    Title="{Binding WindowTitle}" Icon="/PDFRider;component/PdfRider.ico"
    Height="{local:BindToSettings WindowHeight}" Width="{local:BindToSettings WindowWidth}" WindowState="{local:BindToSettings WindowState}"
    MinHeight="300" MinWidth="400"
    Style="{StaticResource GenericStyle}" ResizeMode="CanResizeWithGrip" WindowStartupLocation="CenterScreen"
    AllowDrop="True" MouseMove="BaseWindow_MouseMove" DragEnter="BaseWindow_DragEnter">
    
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Closing">
            <cmd:EventToCommand Command="{Binding CmdClosing}" PassEventArgsToCommand="True" />
        </i:EventTrigger>
        <i:EventTrigger EventName="Drop">
            <cmd:EventToCommand Command="{Binding CmdDropFiles}" PassEventArgsToCommand="True" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    
    <DockPanel LastChildFill="True">

        <Border DockPanel.Dock="Top" BorderBrush="SteelBlue" BorderThickness="2">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Menu Style="{StaticResource MenuStyle}">
                    <MenuItem Header="{ltl:Translate loc_miFile}" Style="{StaticResource MainMenuItemStyle}">
                        <MenuItem Header="{ltl:Translate loc_miHomePage}" 
                                  Command="{Binding CmdHome}">
                            <MenuItem.Icon>
                                <Image Source="..\images\folder_home.png" Style="{StaticResource MenuItemImage}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="{ltl:Translate loc_miOpenFile}" 
                                  Command="{Binding CmdOpenDocument}">
                            <MenuItem.Icon>
                                <Image Source="..\images\folder_yellow_open.png" Style="{StaticResource MenuItemImage}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="{ltl:Translate loc_miSaveFile}" 
                                  Command="{Binding CmdSaveDocument}">
                            <MenuItem.Icon>
                                <Image Source="..\images\filesaveas.png" Style="{StaticResource MenuItemImage}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <!--<Separator />
                        <MenuItem Header="{ltl:Translate loc_miPreferences}" 
                                   >
                            <MenuItem.Icon>
                                <Image Source="..\images\configure.png" Style="{StaticResource MenuItemImage}" />
                            </MenuItem.Icon>
                        </MenuItem>-->
                        <Separator />
                        <MenuItem Header="{ltl:Translate loc_miExit}" 
                                  Command="{Binding CmdClose}" />
                    </MenuItem>
                    
                    <MenuItem Header="{ltl:Translate loc_miTools}" Style="{StaticResource MainMenuItemStyle}">
                        <MenuItem Header="{ltl:Translate loc_miInsertPages}"
                                  Command="{Binding CmdInsertPages}" />
                        <MenuItem Header="{ltl:Translate loc_miExtractPages}"
                                  Command="{Binding CmdExtractPages}" />
                        <MenuItem Header="{ltl:Translate loc_miDeletePages}"
                                  Command="{Binding CmdDeletePages}" />
                        <MenuItem Header="{ltl:Translate loc_miRotatePages}"
                                  Command="{Binding CmdRotatePages}" />
                        <Separator />
                        <MenuItem Header="{ltl:Translate loc_miMergeDocuments}"
                                  Command="{Binding CmdMergeDocuments}" />
                        <Separator />
                        <MenuItem Header="{ltl:Translate loc_miBurst}"
                                  Command="{Binding CmdBurst}" />
                        <Separator />
                        <MenuItem Header="{ltl:Translate loc_miSecurity}"
                                  Command="{Binding CmdSecurity}" />
                    </MenuItem>

                    <MenuItem Header="?" Style="{StaticResource MainMenuItemStyle}">
                        <MenuItem Header="{ltl:Translate loc_miCheckForUpdates}"
                                  Command="{Binding CmdCheckForUpdates}" />
                        <MenuItem Header="{ltl:Translate loc_miAbout}"
                                  Command="{Binding CmdAbout}" />
                    </MenuItem>

                </Menu>
                
                
                <ftc:InformationBar Grid.Row="2" Grid.ColumnSpan="3"
                                    Visibility="{Binding Path=ShowInfoBar, Converter={StaticResource BooleanToVisibilityConverter}}"
                                    Text="{Binding Information}" />
                

            </Grid>
        </Border>
        
        <StatusBar DockPanel.Dock="Bottom" Padding="0" Visibility="Visible">
            <StatusBarItem>
                <TextBlock Text="{Binding Uri}">
                    <TextBlock.Style>
                        <Style TargetType="TextBlock">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsDocumentChanged}" Value="True">
                                    <Setter Property="Foreground" Value="Red"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>
            </StatusBarItem>
        </StatusBar>

        <Border BorderBrush="DarkSlateGray" BorderThickness="2">
            <WebBrowser local:WebBrowserUtility.BindableSource="{Binding Uri, Mode=TwoWay}" Name="browser" />
        </Border>
    </DockPanel>
</local:BaseWindow>
